home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / Apple II / Essentials / Technical.Notes / GSOS / TN.GSOS.009 < prev    next >
Encoding:
Text File  |  1992-07-15  |  4.2 KB  |  90 lines  |  [TEXT/GEOL]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5. GS/OS
  6. #9: Interrupt Handling Anomalies
  7.  
  8. Revised by: Matt Deatherage                                          May 1992
  9. Written by: Dave Lyons                                           January 1990
  10.  
  11. This Technical Note discusses anomalies in the way GS/OS handles interrupts.
  12.  
  13. CHANGES SINCE MAY 1990:  Added discussions about changes to GS/OS interrupt
  14. handling since System Software 5.0.2.
  15. _____________________________________________________________________________
  16.  
  17.  
  18. PROBLEMS INSTALLING INTERRUPT HANDLERS
  19.  
  20. If your application calls ALLOC_INT to install an interrupt handler for an
  21. external interrupt source, it works fine unless the SCSI Manager (GS/OS file
  22. SCSI.Manager) is installed, in which case the system eventually grinds to a
  23. halt with a message about 65536 unclaimed interrupts.
  24.  
  25. THE PROBLEMS
  26.  
  27. If any interrupt handlers are bound (using BindInt) to reference number $17
  28. (IRQ.OTHER), the unclaimed interrupt count gets incremented if none of the
  29. BindInt routines claims the interrupt, even though any handlers installed with
  30. ALLOC_INT routines still need a chance to claim it.  The 5.0.2 SCSI.Manager
  31. triggers this problem because it calls BindInt with vector reference number
  32. $17.
  33.  
  34. In addition, if one or more interrupt handlers are bound to the IRQ.OTHER
  35. vector (VRN $17), the interrupt is passed to the ALLOC_INT handler even if it
  36. was already claimed by a BindInt routine.  If no ALLOC_INT routine claims the
  37. interrupt, the unclaimed-interrupt count is incremented.  As documented in
  38. Apple IIgs Technical Note #18, Do-It-Yourself SCC Interrupts, you cannot
  39. successfully call BindInt with vector reference number $0009.
  40.  
  41. THE SOLUTION
  42.  
  43. An application may install both a BindInt routine and an ALLOC_INT routine.
  44. If they both claim the external interrupt, the unclaimed count does not get
  45. incremented.  The solution is compatible with future System Software releases,
  46. since it does not depend upon the ALLOC_INT routine ever getting called.
  47.  
  48. Your application's BindInt routine sees the interrupt before your ALLOC_INT
  49. routine does, so the BindInt routine should figure out whether the interrupt
  50. was caused by your external device, and claim it if so.  Your ALLOC_INT
  51. routine should claim an interrupt it sees if and only if your BindInt routine
  52. claimed the last interrupt it saw.
  53.  
  54. Starting with GS/OS version 3.2 (released with the Apple II High-Speed SCSI
  55. Card), the system no longer treats too many unclaimed interrupts as a fatal
  56. error.  However, before version 6.0, it still counts the unclaimed interrupts
  57. so it can do something like display a dialog asking you to restart even though
  58. choosing "restart" returns you to the application unharmed (GS/OS version
  59. 3.2), or sometimes display a dialog box sending you to your dealer and
  60. sometimes not (version 3.3), or do nothing about it at all (version 4.0 and
  61. later).  This is obviously as confusing to most of us as it was to the system
  62. itself, so fortunately GS/OS now ignores unclaimed interrupts and doesn't even
  63. bother counting them.
  64.  
  65.  
  66. PROBLEMS REMOVING INTERRUPTS HANDLERS
  67.  
  68. The GS/OS Reference suite says that device drivers may make BindInt and
  69. UnbindInt calls, noting this as an exception to the general rule that drivers
  70. may not make GS/OS system calls.  What the references fail to note is that
  71. these calls may fail for an incredibly annoying reason--the OS may be busy.
  72.  
  73. GS/OS takes special pains to avoid this while starting and while switching to
  74. ProDOS 8, but it does not avoid this condition during an OSShutDown--a real
  75. shutdown of the OS, not a switch to ProDOS 8.
  76.  
  77. Driver authors can work around this problem by using a new system service call
  78. provided in GS/OS version 3.2 and later.  The call, named UNBIND_INT_VECTOR,
  79. provides the functionality of UnbindInt to FSTs and drivers only to avoid the
  80. OS reentrancy issue.  The vector is at $01/FCD8 and takes an interrupt
  81. identification number (as returned from BindInt) in the accumulator.
  82.  
  83.  
  84. Further Reference
  85. _____________________________________________________________________________
  86.  
  87.    o   GS/OS Reference
  88.    o   Apple IIgs Technical Note #18, Do-It-Yourself SCC Interrupts
  89.  
  90.